package clientGUI.userPanels;

import javax.swing.JLabel;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JTextField;


import clientGUI.userPanels.Controllers.TestPanelController;
import clientserver.Client;

public class TestPanel extends UPanel implements ActionListener {
	private JTextField textField;
	private TestPanelController c;
	private String s;
	private JButton btnNewButton;
	private JButton btnNewButton_1;
	private JButton btnMainMenu;
	

	/**
	 * Create the panel.
	 */
	public TestPanel(int id,Client cl) 
	{
		setLayout(null);
		c = new TestPanelController(cl, id);
		JLabel lblTesterPerspective = new JLabel("TESTER PERSPECTIVE");
		lblTesterPerspective.setBounds(158, 0, 182, 14);
		add(lblTesterPerspective);
	
		
		textField = new JTextField();
		textField.setBounds(165, 55, 223, 20);
		add(textField);
		textField.setColumns(10);
		
		 btnNewButton = new JButton("Approve Test");
		btnNewButton.setBounds(295, 188, 111, 23);
		add(btnNewButton);
		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) 
			{
				c.testPass();
			}
		});
		
		
		 btnNewButton_1 = new JButton("Submit Failure Description");
		btnNewButton_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) 
			{
				s = textField.getText();
				c.denyAndDescription(s);
				
			}
		});
		btnNewButton_1.setBounds(31, 188, 182, 23);
		add(btnNewButton_1);
		
		JLabel lblFillTestFailure = new JLabel("Fill test failure description :");
		lblFillTestFailure.setBounds(31, 58, 134, 14);
		add(lblFillTestFailure);
		
		btnMainMenu = new JButton("Main Menu");
		btnMainMenu.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) 
			{
				myframe.SetMainUserPanel();
			}
		});
		btnMainMenu.setBounds(295, 251, 111, 23);
		add(btnMainMenu);
		
		

	}

	@Override
	public void actionPerformed(ActionEvent arg0) {
		// TODO Auto-generated method stub
		
	}

}
